from django.db import models
from rest_framework import serializers


# Create your models here.
class User(models.Model):
    id = models.AutoField(primary_key=True)
    username = models.CharField(max_length=20,unique=True,verbose_name='用户名')
    password = models.CharField(max_length=20,verbose_name='密码')
    avatarUrl = models.CharField(max_length=225,null=True,verbose_name='用户头像地址')
    scanCount = models.IntegerField(default=0,verbose_name='识别次数')
    created_time = models.DateTimeField(auto_now_add=True, verbose_name="创建时间")  # 创建时间
    login_date = models.DateField(auto_now=True, verbose_name="最后登录时间")
    class Meta:
        db_table = 'user'

class UserSerializer(serializers.ModelSerializer):
    class Meta:
        model = User
        fields = '__all__'